﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NamTrungBS.DataLayer;


namespace NamTrungBS
{
    public partial class MoHoaDon : DevComponents.DotNetBar.Office2007Form
    {
        NamTrungDBDataContext db = new NamTrungDBDataContext();
        public LuuHoaDon hoaDonOpen;
        public MoHoaDon()
        {
            InitializeComponent();
            this.dataGridViewHoaDonLuu.DataSource = db.LuuHoaDons;
        }

        private void btnBoqua_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOpen_Click(object sender, EventArgs e)
        {
            try {
               DataGridViewRow rowSelect=this.dataGridViewHoaDonLuu.SelectedRows[0];
               int mahoadon = int.Parse(rowSelect.Cells[0].Value.ToString());
               this.hoaDonOpen = db.LuuHoaDons.Where(od => od.MaHD == mahoadon).FirstOrDefault();
               this.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            
        }


    }
}
